package cn.tedu.springbootdemo.bean;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component;

@Component
/**
 * 在Spring中缺少Saw.class类型对象时候，就创建当前
 * 的 Axe 类型的对象
 */
@ConditionalOnMissingBean(Saw.class)
public class Axe implements Tool {
    @Override
    public String toString() {
        return "斧子";
    }
}
